﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace RockCompany.Common.Lib
{
    public class InforDialog
    {
        public static void showErrorBox(Form owner, string sError, string sCaption)
        {
            MessageBox.Show(owner, sError, sCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        public static void showInforBox(Form owner, string sInfor, string sCaption)
        {
            MessageBox.Show(owner, sInfor, sCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);

        }
        
        public static void showWarningrBox(Form owner, string sMsg, string sCaption)
        {
            MessageBox.Show(owner, sMsg, sCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }

        public static void showMessageBox(string title, string message)
        {
            MessageBox.Show(message, title);
        }

        public static bool showConfirmBox(string title, string message)
        {
            return MessageBox.Show(message, title, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
        }

        public static string showSaveFileDlg(Form owner)
        {
            string fullPath = "";
            SaveFileDialog dlg = new SaveFileDialog();
            dlg.DefaultExt = "xls";
            dlg.Title = owner.Text;
            if (dlg.ShowDialog(owner) == DialogResult.OK)
            {
                if (dlg.FileName.IndexOf(dlg.DefaultExt) < 0)
                    dlg.FileName += "." + dlg.DefaultExt;
                fullPath = dlg.InitialDirectory + dlg.FileName;
            }
            return fullPath;
        }

        public static void showInforBox(string p, string p_2)
        {
            throw new NotImplementedException();
        }
    }
}
